﻿/*
 * ============ [ 废土 ] ============
 *
 * [ 维护者 ]  argoran@gmail.com
 * [  状态  ]  原型
 *
 * ============ [ 注释 ] ============
 *
 * 处理logout指令的类
 *
 * ==================================
 */

using LastLandClient.Data;

using Up2Link.SegString;

namespace LastLandClient.Core.CmdInterpreter
{
    public class CCmdLogout : ICommandInterpreter
    {
        public void ExecuteCommand(string _cmd, string _args)
        {
            if (_args == null && CData.clientConnected)
            {
                CMessageSS logoutMsg = new CMessageSS(CConst.CLIENT_MESSAGE_LOGOUT, 0, CMessageSS.ENCODING_UTF32, "");
                CData.client.Send(logoutMsg);
            }
            else if (_args != null)
            {
                CData.console.SendOutput("logout指令不接受任何参数");
            }
            else if (!CData.clientConnected)
            {
                CData.console.SendOutput("玩家尚未连接服务器");
            }
            else
            {
                CData.console.SendOutput("无效的指令");
            }
        }
    }
}
